
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>AHCI磁盘驱动分析 · book for xbook2</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="jason hu">
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="keyboard.html" />
    
    
    <link rel="prev" href="device.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    
    
        
        <li>
            <a href="https://book-os.org" target="_blank" class="custom-link">bookos</a>
        </li>
    
    

    
    <li class="divider"></li>
    

    
        
        
    
        <li class="chapter " data-level="1.1" >
            
                <span>
            
                    
                    xbook2文档中心
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1.1" >
            
                <span>
            
                    
                    简介
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1.1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    xbook2 简介
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.1.2" >
            
                <span>
            
                    
                    快速上手
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1.2.1" data-path="../../tutorial/quick-start.html">
            
                <a href="../../tutorial/quick-start.html">
            
                    
                    Qemu x86
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.1.3" >
            
                <span>
            
                    
                    内核
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1.3.1" data-path="../base/base.html">
            
                <a href="../base/base.html">
            
                    
                    内核基础
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.1.3.2" data-path="../task/task.html">
            
                <a href="../task/task.html">
            
                    
                    任务管理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.1.3.3" data-path="../timer/timer.html">
            
                <a href="../timer/timer.html">
            
                    
                    时钟管理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.1.3.4" data-path="../mm/mm.html">
            
                <a href="../mm/mm.html">
            
                    
                    内存管理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.1.3.5" data-path="device.html">
            
                <a href="device.html">
            
                    
                    设备管理
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter active" data-level="1.1.3.5.1" data-path="ahci.html">
            
                <a href="ahci.html">
            
                    
                    AHCI磁盘驱动分析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.1.3.5.2" data-path="keyboard.html">
            
                <a href="keyboard.html">
            
                    
                    PS/2键盘驱动分析
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.1.4" >
            
                <span>
            
                    
                    用户
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1.4.1" data-path="../user/user.html">
            
                <a href="../user/user.html">
            
                    
                    用户编程
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.1.5" >
            
                <span>
            
                    
                    other
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1.5.1" data-path="../../other/FAQS.html">
            
                <a href="../../other/FAQS.html">
            
                    
                    FAQS
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >AHCI磁盘驱动分析</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="ahci&#x78C1;&#x76D8;&#x9A71;&#x52A8;&#x5206;&#x6790;">AHCI&#x78C1;&#x76D8;&#x9A71;&#x52A8;&#x5206;&#x6790;</h1>
<h2 id="&#x521D;&#x59CB;&#x5316;">&#x521D;&#x59CB;&#x5316;</h2>
<p>&#x5728;&#x672C;&#x9A71;&#x52A8;&#x4E2D;&#xFF0C;&#x6211;&#x4EEC;&#x53EA;&#x9700;&#x8981;&#x5173;&#x6CE8;&#x6709;&#x5DEE;&#x5F02;&#x7684;&#x5730;&#x65B9;&#xFF0C;&#x62FF;&#x51FA;&#x6765;&#x8BB2;&#x4E00;&#x4E0B;&#x5C31;&#x884C;&#x4E86;&#x3002;</p>
<pre><code class="lang-c"><span class="hljs-keyword">iostatus_t</span> ahci_create_device(<span class="hljs-keyword">driver_object_t</span> *driver, <span class="hljs-keyword">device_extension_t</span> *dev)
{
    <span class="hljs-keyword">iostatus_t</span> status ;
    <span class="hljs-keyword">device_object_t</span> *devobj;
    <span class="hljs-keyword">char</span> devname[DEVICE_NAME_LEN] = {<span class="hljs-number">0</span>};

    <span class="hljs-built_in">sprintf</span>(devname, <span class="hljs-string">&quot;%s%c&quot;</span>, DEV_NAME, <span class="hljs-string">&apos;a&apos;</span> + ahci_next_device);
    ahci_next_device++;
    <span class="hljs-comment">/* &#x521D;&#x59CB;&#x5316;&#x4E00;&#x4E9B;&#x5176;&#x5B83;&#x5185;&#x5BB9; */</span>
    status = io_create_device(driver, <span class="hljs-number">0</span>, devname, DEVICE_TYPE_DISK, &amp;devobj);
    <span class="hljs-keyword">if</span> (status != IO_SUCCESS) {
        keprint(PRINT_ERR <span class="hljs-string">&quot;[ahci]: create device on port %d failed!\n&quot;</span>, dev-&gt;idx);
        <span class="hljs-keyword">return</span> status;
    }
    <span class="hljs-comment">/* buffered io mode */</span>
    devobj-&gt;flags = DO_BUFFERED_IO;
    devobj-&gt;device_extension = dev;
    dev-&gt;device_object = devobj;
    dev-&gt;created = <span class="hljs-number">1</span>;
    dev-&gt;rwoffset = <span class="hljs-number">0</span>;
    <span class="hljs-keyword">return</span> status;
}
</code></pre>
<p>&#x5728;<code>io_create_device</code>&#x521B;&#x5EFA;&#x8BBE;&#x5907;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x6211;&#x4EEC;&#x628A;&#x62D3;&#x5C55;&#x8BBE;&#x7F6E;&#x4E3A;0&#xFF0C;&#x5C31;&#x4E0D;&#x4F1A;&#x521B;&#x5EFA;&#x6269;&#x5C55;&#x533A;&#x57DF;&#xFF0C;&#x90A3;&#x4E48;<code>devobj-&gt;device_extension</code>&#x5C31;&#x662F;NULL&#xFF0C;&#x5BF9;&#x4E8E;&#x8FD9;&#x91CC;&#x7684;&#x6269;&#x5C55;&#xFF0C;&#x6211;&#x4EEC;&#x662F;&#x5728;&#x540E;&#x9762;&#x76F4;&#x63A5;&#x7ED1;&#x5B9A;&#x4E86;&#x6269;&#x5C55;&#x7684;&#x6307;&#x9488;<code>devobj-&gt;device_extension = dev;</code></p>
<p>&#x8FD9;&#x91CC;&#x9009;&#x7528;&#x4E86;<code>DO_BUFFERED_IO</code>&#x6A21;&#x5F0F;&#xFF0C;&#x56E0;&#x6B64;&#x78C1;&#x76D8;&#x9A71;&#x52A8;&#x53EF;&#x80FD;&#x4F1A;&#x5728;&#x5176;&#x5B83;&#x8FDB;&#x7A0B;&#x6267;&#x884C;&#x65F6;&#x4EA7;&#x751F;&#x4E2D;&#x65AD;&#x6765;&#x8BFB;&#x5199;&#x6570;&#x636E;&#x3002;</p>
<h2 id="&#x8BFB;&#x5199;&#x64CD;&#x4F5C;">&#x8BFB;&#x5199;&#x64CD;&#x4F5C;</h2>
<pre><code class="lang-c"><span class="hljs-keyword">iostatus_t</span> ahci_read(<span class="hljs-keyword">device_object_t</span> *device, <span class="hljs-keyword">io_request_t</span> *ioreq)
{
    <span class="hljs-keyword">long</span> len;
    <span class="hljs-keyword">iostatus_t</span> status = IO_SUCCESS;
    <span class="hljs-keyword">sector_t</span> sectors = DIV_ROUND_UP(ioreq-&gt;parame.read.length, SECTOR_SIZE);
    <span class="hljs-keyword">device_extension_t</span> *ext = device-&gt;device_extension;

<span class="hljs-meta">#<span class="hljs-meta-keyword">ifdef</span> DEBUG_AHCI</span>
    keprint(PRINT_DEBUG <span class="hljs-string">&quot;ahci_read: buf=%x sectors=%d off=%x\n&quot;</span>, 
        ioreq-&gt;system_buffer, sectors, ioreq-&gt;parame.read.offset);
<span class="hljs-meta">#<span class="hljs-meta-keyword">endif</span>    </span>
    <span class="hljs-keyword">unsigned</span> <span class="hljs-keyword">long</span> off;    
    <span class="hljs-keyword">if</span> (ioreq-&gt;parame.read.offset == DISKOFF_MAX) {
        off = ext-&gt;rwoffset;
    } <span class="hljs-keyword">else</span> {
        off = ioreq-&gt;parame.read.offset;
    }
    len = ahci_read_sector(device-&gt;device_extension, off,
        ioreq-&gt;system_buffer, sectors);
    <span class="hljs-keyword">if</span> (!len) { <span class="hljs-comment">/* &#x6267;&#x884C;&#x5931;&#x8D25; */</span>
        status = IO_FAILED;
        len = <span class="hljs-number">0</span>;
    }

    ioreq-&gt;io_status.status = status;
    ioreq-&gt;io_status.infomation = len;

    io_complete_request(ioreq);

    <span class="hljs-keyword">return</span> status;
}

<span class="hljs-keyword">iostatus_t</span> ahci_write(<span class="hljs-keyword">device_object_t</span> *device, <span class="hljs-keyword">io_request_t</span> *ioreq)
{
    <span class="hljs-keyword">long</span> len;
    <span class="hljs-keyword">iostatus_t</span> status = IO_SUCCESS;
    <span class="hljs-keyword">sector_t</span> sectors = DIV_ROUND_UP(ioreq-&gt;parame.write.length, SECTOR_SIZE);
    <span class="hljs-keyword">device_extension_t</span> *ext = device-&gt;device_extension;

<span class="hljs-meta">#<span class="hljs-meta-keyword">ifdef</span> DEBUG_AHCI</span>
    keprint(PRINT_DEBUG <span class="hljs-string">&quot;ahci_write: buf=%x sectors=%d off=%x\n&quot;</span>, 
        ioreq-&gt;system_buffer, sectors, ioreq-&gt;parame.write.offset);
<span class="hljs-meta">#<span class="hljs-meta-keyword">endif</span>    </span>
    <span class="hljs-keyword">unsigned</span> <span class="hljs-keyword">long</span> off;    
    <span class="hljs-keyword">if</span> (ioreq-&gt;parame.write.offset == DISKOFF_MAX) {
        off = ext-&gt;rwoffset;
    } <span class="hljs-keyword">else</span> {
        off = ioreq-&gt;parame.write.offset;
    }
    len = ahci_write_sector(device-&gt;device_extension, off,
        ioreq-&gt;system_buffer, sectors);

    <span class="hljs-keyword">if</span> (!len) { <span class="hljs-comment">/* &#x6267;&#x884C;&#x5931;&#x8D25; */</span>
        status = IO_FAILED;
        len = <span class="hljs-number">0</span>;
    }

    ioreq-&gt;io_status.status = status;
    ioreq-&gt;io_status.infomation = len;

    io_complete_request(ioreq);

    <span class="hljs-keyword">return</span> status;
}
</code></pre>
<p>&#x5728;<code>ahci_read</code>&#x91CC;&#x9762;&#x901A;&#x8FC7;<code>ioreq-&gt;parame.read.offset</code>&#x6765;&#x83B7;&#x5F97;&#x8BFB;&#x53D6;&#x7684;&#x504F;&#x79FB;&#xFF0C;&#x5C31;&#x662F;&#x4ECE;&#x54EA;&#x4E2A;&#x6247;&#x533A;&#x5F00;&#x59CB;&#x8BFB;&#x53D6;&#x3002;&#x56E0;&#x4E3A;<code>device flags</code>&#x7528;&#x7684;&#x662F;<code>DO_BUFFERD_IO</code>,&#x6240;&#x4EE5;&#x8FD9;&#x91CC;&#x4F7F;&#x7528;<code>ioreq-&gt;system_buffer</code>&#x6765;&#x5B58;&#x653E;&#x8BFB;&#x53D6;&#x7684;&#x6570;&#x636E;&#x3002;&#x540C;&#x7406;&#x5728;<code>ahci_write</code>&#x91CC;&#x9762;&#x901A;&#x8FC7;<code>ioreq-&gt;parame.write.offset</code>&#x6765;&#x83B7;&#x5F97;&#x8BFB;&#x53D6;&#x7684;&#x504F;&#x79FB;&#xFF0C;&#x5C31;&#x662F;&#x4ECE;&#x54EA;&#x4E2A;&#x6247;&#x533A;&#x5F00;&#x59CB;&#x5199;&#x5165;&#x6570;&#x636E;&#x3002;</p>
<p>&#x5B8C;&#x6210;&#x64CD;&#x4F5C;&#x540E;&#xFF0C;&#x6267;&#x884C;<code>ioreq-&gt;io_status.infomation = len;</code>&#x6765;&#x5C06;&#x8BFB;&#x53D6;&#x7684;&#x6570;&#x636E;&#x91CF;&#x8FD4;&#x56DE;&#xFF0C;&#x8FD9;&#x6837;&#x5C31;&#x53EF;&#x4EE5;&#x77E5;&#x9053;&#x8BFB;&#x53D6;&#x4E86;&#x591A;&#x5C11;&#x6570;&#x636E;&#x4E86;&#x3002;&#x6700;&#x540E;&#x8C03;&#x7528;<code>io_complete_request(ioreq);</code>&#x5B8C;&#x6210;&#x8BF7;&#x6C42;&#x3002;</p>
<h2 id="&#x8BBE;&#x5907;&#x63A7;&#x5236;">&#x8BBE;&#x5907;&#x63A7;&#x5236;</h2>
<pre><code class="lang-c"><span class="hljs-keyword">iostatus_t</span> ahci_devctl(<span class="hljs-keyword">device_object_t</span> *device, <span class="hljs-keyword">io_request_t</span> *ioreq)
{
    <span class="hljs-keyword">unsigned</span> <span class="hljs-keyword">int</span> ctlcode = ioreq-&gt;parame.devctl.code;
    <span class="hljs-keyword">unsigned</span> <span class="hljs-keyword">long</span> arg = ioreq-&gt;parame.devctl.arg;
    <span class="hljs-keyword">unsigned</span> <span class="hljs-keyword">long</span> off;
    <span class="hljs-keyword">device_extension_t</span> *ext = device-&gt;device_extension;

    <span class="hljs-keyword">iostatus_t</span> status = IO_SUCCESS;
    <span class="hljs-keyword">int</span> infomation = <span class="hljs-number">0</span>;
    <span class="hljs-keyword">switch</span> (ctlcode)
    {
    <span class="hljs-keyword">case</span> DISKIO_GETSIZE:
        *((<span class="hljs-keyword">unsigned</span> <span class="hljs-keyword">int</span> *) arg) = ext-&gt;size; 
        <span class="hljs-keyword">break</span>;
    <span class="hljs-keyword">case</span> DISKIO_CLEAR:
        <span class="hljs-comment">//ahci_clean_disk(device-&gt;device_extension, arg);</span>
        <span class="hljs-keyword">break</span>;
    <span class="hljs-keyword">case</span> DISKIO_SETOFF:
        off = *((<span class="hljs-keyword">unsigned</span> <span class="hljs-keyword">long</span> *) arg);
        <span class="hljs-keyword">if</span> (off &gt; ext-&gt;size - <span class="hljs-number">1</span>)
            off = ext-&gt;size - <span class="hljs-number">1</span>;
        ext-&gt;rwoffset = off;
        <span class="hljs-keyword">break</span>;
    <span class="hljs-keyword">case</span> DISKIO_GETOFF:
        *((<span class="hljs-keyword">unsigned</span> <span class="hljs-keyword">long</span> *) arg) = ext-&gt;rwoffset;
    <span class="hljs-keyword">default</span>:
        infomation = <span class="hljs-number">-1</span>;
        status = IO_FAILED;
        <span class="hljs-keyword">break</span>;
    }
    ioreq-&gt;io_status.status = status;
    ioreq-&gt;io_status.infomation = infomation;
    io_complete_request(ioreq);
    <span class="hljs-keyword">return</span> status;
}
</code></pre>
<p>&#x8BBE;&#x5907;&#x63A7;&#x5236;&#x662F;&#x5BF9;&#x8BBE;&#x5907;&#x8FDB;&#x884C;&#x4E00;&#x4E2A;IO&#x63A7;&#x5236;&#xFF0C;&#x53EF;&#x4EE5;&#x4ECE;&#x8BBE;&#x5907;&#x83B7;&#x53D6;&#x6216;&#x8005;&#x5199;&#x5165;&#x914D;&#x7F6E;&#x3002;&#x5728;&#x8FD9;&#x91CC;&#xFF0C;&#x6211;&#x4EEC;&#x901A;&#x8FC7;<code>ioreq-&gt;parame.devctl.code</code>&#x83B7;&#x53D6;&#x63A7;&#x5236;&#x7801;&#xFF0C;&#x5728;&#x7528;switch&#x6839;&#x636E;&#x4E0D;&#x540C;&#x7684;&#x63A7;&#x5236;&#x7801;&#x6267;&#x884C;&#x4E0D;&#x540C;&#x7684;&#x64CD;&#x4F5C;&#x3002;&#x9664;&#x6B64;&#x4E4B;&#x5916;&#xFF0C;&#x8FD8;&#x53EF;&#x4EE5;&#x4F20;&#x4E00;&#x4E2A;&#x53C2;&#x6570;&#x5730;&#x5740;<code>ioreq-&gt;parame.devctl.arg</code>&#xFF0C;&#x7136;&#x540E;&#x53EF;&#x4EE5;&#x4ECE;&#x53C2;&#x6570;&#x5730;&#x5740;&#x4E0A;&#x8BFB;&#x53D6;&#x6216;&#x8005;&#x5199;&#x5165;&#x6570;&#x636E;&#x3002;</p>
<h2 id="&#x4E2D;&#x65AD;&#x5904;&#x7406;">&#x4E2D;&#x65AD;&#x5904;&#x7406;</h2>
<pre><code class="lang-c"><span class="hljs-function"><span class="hljs-keyword">static</span> <span class="hljs-keyword">int</span> <span class="hljs-title">ahci_handler</span><span class="hljs-params">(irqno_t irq, <span class="hljs-keyword">void</span> *data)</span>
</span>{
    <span class="hljs-keyword">int</span> intrhandled = IRQ_NEXTONE;
    <span class="hljs-keyword">int</span> i;
    <span class="hljs-keyword">for</span>(i=<span class="hljs-number">0</span>;i&lt;<span class="hljs-number">32</span>;i++) {
        <span class="hljs-keyword">if</span>(hba_mem-&gt;interrupt_status &amp; (<span class="hljs-number">1</span> &lt;&lt; i)) {
            dbgprint(<span class="hljs-string">&quot;ahci: interrupt %d occur!\n&quot;</span>, i);
            hba_mem-&gt;ports[i].interrupt_status = ~<span class="hljs-number">0</span>;
            hba_mem-&gt;interrupt_status = (<span class="hljs-number">1</span> &lt;&lt; i);
            ahci_flush_commands((<span class="hljs-keyword">struct</span> hba_port *)&amp;hba_mem-&gt;ports[i]);
            intrhandled = IRQ_HANDLED;
        }
    }
    <span class="hljs-keyword">return</span> intrhandled;
}

irq_register(ahci_int, ahci_handler, IRQF_SHARED, <span class="hljs-string">&quot;ahci&quot;</span>, <span class="hljs-string">&quot;ahci driver&quot;</span>, (<span class="hljs-keyword">void</span> *)driver);
</code></pre>
<p>&#x5728;&#x8FD9;&#x4E2A;&#x9A71;&#x52A8;&#x6848;&#x4F8B;&#x4E2D;&#xFF0C;<code>flags</code>&#x662F;<code>IRQF_SHARED</code>&#xFF0C;&#x8868;&#x793A;&#x8FD9;&#x662F;&#x4E00;&#x4E2A;&#x5171;&#x4EAB;&#x4E2D;&#x65AD;&#xFF0C;<code>data</code>&#x4E3A;<code>driver</code>&#x9A71;&#x52A8;&#x672C;&#x8EAB;&#x3002;</p>
<p>&#x5728;&#x4E2D;&#x65AD;&#x5904;&#x7406;&#x51FD;&#x6570;&#x4E2D;&#x867D;&#x7136;&#x6CA1;&#x6709;&#x7528;&#x5230;<code>data</code>&#x8FD9;&#x4E2A;&#x53D8;&#x91CF;&#xFF0C;&#x4F46;&#x662F;&#x5FC5;&#x987B;&#x4F20;&#x5165;&#x4E00;&#x4E2A;&#x5730;&#x5740;&#xFF0C;&#x6765;&#x8868;&#x660E;&#x5B83;&#x4E0D;&#x540C;&#x4E8E;&#x5176;&#x5B83;&#x9A71;&#x52A8;&#xFF0C;&#x8FD9;&#x662F;&#x5171;&#x4EAB;&#x4E2D;&#x65AD;&#x5FC5;&#x987B;&#x7684;&#x3002;</p>
<p>&#x5728;<code>ahci_handler</code>&#x4E2D;&#xFF0C;&#x5982;&#x679C;&#x4E2D;&#x65AD;&#x88AB;&#x5904;&#x7406;&#x4E86;&#xFF0C;&#x5C31;&#x8FD4;&#x56DE;<code>IRQ_HANDLED</code>&#xFF0C;&#x6CA1;&#x6709;&#x88AB;&#x5904;&#x7406;&#x5C31;&#x8FD4;&#x56DE;<code>IRQ_NEXTONE</code>&#xFF0C;&#x8868;&#x793A;&#x9700;&#x8981;&#x5176;&#x5B83;&#x9A71;&#x52A8;&#x5904;&#x7406;&#x4E2D;&#x65AD;&#x3002;</p>
<footer class="page-footer"><span class="copyright">Copyright &#xA9; BookOS-developers 2021 all right reserved&#xFF0C;powered by Gitbook</span><span class="footer-modification">&#x4FEE;&#x8BA2;&#x65F6;&#x95F4;&#xFF1A;
2021-06-16
</span></footer>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="device.html" class="navigation navigation-prev " aria-label="Previous page: 设备管理">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="keyboard.html" class="navigation navigation-next " aria-label="Next page: PS/2键盘驱动分析">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"AHCI磁盘驱动分析","level":"1.1.3.5.1","depth":4,"next":{"title":"PS/2键盘驱动分析","level":"1.1.3.5.2","depth":4,"path":"programing-manual/device/keyboard.md","ref":"programing-manual/device/keyboard.md","articles":[]},"previous":{"title":"设备管理","level":"1.1.3.5","depth":3,"path":"programing-manual/device/device.md","ref":"programing-manual/device/device.md","articles":[{"title":"AHCI磁盘驱动分析","level":"1.1.3.5.1","depth":4,"path":"programing-manual/device/ahci.md","ref":"programing-manual/device/ahci.md","articles":[]},{"title":"PS/2键盘驱动分析","level":"1.1.3.5.2","depth":4,"path":"programing-manual/device/keyboard.md","ref":"programing-manual/device/keyboard.md","articles":[]}]},"dir":"ltr"},"config":{"plugins":["tbfed-pagefooter","livereload"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"tbfed-pagefooter":{"copyright":"Copyright &copy BookOS-developers 2021","modify_label":"修订时间：","modify_format":"YYYY-MM-DD"},"livereload":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"jason hu","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"book for xbook2","language":"zh-hans","links":{"sidebar":{"bookos":"https://book-os.org"}},"gitbook":"3.2.3","description":"document for xbook2 kernel"},"file":{"path":"programing-manual/device/ahci.md","mtime":"2021-06-16T14:03:55.636Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2021-06-16T14:18:02.822Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

